<template>
  <div class="tops">
    <i :class="zhuangtai" @click="changeMenUS"></i>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <transition-group name="breadcrumb" >
        <el-breadcrumb-item v-for="item of rou" :key="item.path" :to="item.path">{{item.meta.name}}</el-breadcrumb-item>
      </transition-group>
    </el-breadcrumb>
  </div>
</template>

<script>
export default {
  props: ["state"],
  methods: {
    changeMenUS() {
      this.$emit("bian");
    }
  },
  computed: {
    rou() {
      let arr = this.$route.matched;
      let newarry = [];
      arr.forEach(item => {
        // console.log(item);
        if (item.meta.name) {
          newarry.push(item);
        }
      });
      return newarry;
    }
  },
  data() {
    return {
      zhuangtai: {
        icon: true,
        "el-icon-s-fold": !this.state,
        "el-icon-s-unfold": this.state
      }
    };
  },
  watch: {
    state(value) {
      this.zhuangtai["el-icon-s-fold"] = !value;
      this.zhuangtai["el-icon-s-unfold"] = value;
    },
  }
};
</script>
<style>
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.28s;
}

.fade-enter,
.fade-leave-active {
  opacity: 0;
}

.fade-transform-leave-active,
.fade-transform-enter-active {
  transition: all 0.5s;
}

.fade-transform-enter {
  opacity: 0;
  transform: translateX(-30px);
}

.fade-transform-leave-to {
  opacity: 0;
  transform: translateX(30px);
}
.breadcrumb-enter-active,
.breadcrumb-leave-active {
  transition: all 0.5s;
}

.breadcrumb-enter,
.breadcrumb-leave-active {
  opacity: 0;
  transform: translateX(20px);
}

.breadcrumb-move {
  transition: all 0.5s;
}

.breadcrumb-leave-active {
  position: absolute;
}
</style>
<style lang='sass'>
.tops   
  height: 60px
  padding: 0 10px
  display: flex
  align-items: center
  background-color: #ffffff
.icon
  font-size: 40px
  color: #555555
  cursor: pointer
  margin-right: 50px
.el-avatar
  margin-right: 50px

</style>